'use strict'


import Http from '../kit/HttpKit'
import Api from './Api'

const URL_LIST = Api.API_URL + '/member/list'
const URL_VISITOR_LIST = Api.API_URL + '/member/visitorList'
const URL_SET_SEAL = Api.API_URL + '/member/setSeal'
const URL_SET_NORMAL = Api.API_URL + '/member/setNormal'
const URL_CHECK_STATUS_PASS = Api.API_URL + '/member/checkStatusPass'
const URL_CHECK_STATUS_FAIL = Api.API_URL + '/member/checkStatusFail'
const URL_SUPER_COMPANY_LIST = Api.API_URL + '/member/superCompanyList'
const URL_SUPER_COMPANY_CHECK_STATUS_PASS = Api.API_URL + '/member/superCompanyCheckStatusPass'
const URL_SUPER_COMPANY_CHECK_STATUS_FAIL = Api.API_URL + '/member/superCompanyCheckStatusFail'
const URL_STORE_LIST = Api.API_URL + '/member/storeList'
const URL_STORE_DETAIL = Api.API_URL + '/member/storeDetail'
const URL_STORE_CHECK_STATUS_PASS = Api.API_URL + '/member/storeCheckStatusPass'
const URL_STORE_CHECK_STATUS_FAIL = Api.API_URL + '/member/storeCheckStatusFail'
const URL_COMMERCE_LIST = Api.API_URL + '/member/commerceList'
const URL_COMMERCE_DETAIL = Api.API_URL + '/member/commerceDetail'
const URL_COMMERCE_CHECK_STATUS_PASS = Api.API_URL + '/member/commerceCheckStatusPass'
const URL_COMMERCE_CHECK_STATUS_FAIL = Api.API_URL + '/member/commerceCheckStatusFail'

/**
* 用户信息模块
**/
const list = (data, callback)=>{
	var url = Api.API_URL + '/member/list';

	data.api_token = Api.getApiToken();
	data.api_user_id = Api.getApiUserId();

	Http.post(url, data, json=>{
		Api.getDataCB(json, callback);
	});
}
const visitorList = (data, callback)=>{
	data.api_token = Api.getApiToken();
	data.api_user_id = Api.getApiUserId();
	Http.post(URL_VISITOR_LIST, data, json=>{
		Api.getDataCB(json, callback);
	});
}
const detail = (accountId, callback)=>{
	var url = Api.API_URL + '/member/detail';

	let data = {accountId: accountId};
	data.api_token = Api.getApiToken();
	data.api_user_id = Api.getApiUserId();

	Http.post(url, data, json=>{
		Api.getDataCB(json, callback);
	});
}
/**
 * 超级公司申请列表用户信息
 **/
const superCompanyList = (data, callback)=>{
	data.api_token = Api.getApiToken();
	data.api_user_id = Api.getApiUserId();

	Http.post(URL_SUPER_COMPANY_LIST, data, json=>{
		Api.getDataCB(json, callback);
	});
}
const storeList = (data, callback)=>{
	data.api_token = Api.getApiToken();
	data.api_user_id = Api.getApiUserId();

	Http.post(URL_STORE_LIST, data, json=>{
		Api.getDataCB(json, callback);
	});
}
const storeDetail = (storeId, callback)=>{
	let data = {storeId: storeId};
	data.api_token = Api.getApiToken();
	data.api_user_id = Api.getApiUserId();
	Http.post(URL_STORE_DETAIL, data, json=>{
		Api.getDataCB(json, callback);
	});
}
const commerceList = (data, callback)=>{
	data.api_token = Api.getApiToken();
	data.api_user_id = Api.getApiUserId();

	Http.post(URL_COMMERCE_LIST, data, json=>{
		Api.getDataCB(json, callback);
	});
}
const commerceDetail = (id, callback)=>{
	let data = {id: id};
	data.api_token = Api.getApiToken();
	data.api_user_id = Api.getApiUserId();
	Http.post(URL_COMMERCE_DETAIL, data, json=>{
		Api.getDataCB(json, callback);
	});
}
export default{
	list, visitorList,detail, superCompanyList,
	URL_LIST,URL_VISITOR_LIST, URL_SET_SEAL, URL_SET_NORMAL,
	URL_CHECK_STATUS_PASS, URL_CHECK_STATUS_FAIL,
	URL_SUPER_COMPANY_LIST,
	URL_SUPER_COMPANY_CHECK_STATUS_PASS,
	URL_SUPER_COMPANY_CHECK_STATUS_FAIL,
	storeList,
	storeDetail,
	URL_STORE_LIST,
	URL_STORE_CHECK_STATUS_PASS,
	URL_STORE_CHECK_STATUS_FAIL,
	commerceList,
	commerceDetail,
	URL_COMMERCE_LIST,
	URL_COMMERCE_CHECK_STATUS_PASS,
	URL_COMMERCE_CHECK_STATUS_FAIL
}
